package train48days;

import java.util.Scanner;

public class MP3光标位置 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            String s = sc.next();
            get(n, s);
        }
    }
    private static void get(int n,String s){
        int start = 1,end = Math.min(n,4),index=1;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i)=='U'){
                if (index==1){
                    index=n;
                }else {
                    index--;
                }
            }else if (s.charAt(i)=='D'){
                if (index==n){
                    index=1;
                }else{
                    index++;
                }
            }
            if (index<start){
                start=index;
                end=start+3;
            } else if (index>end){
                end=index;
                start=end-3;
            }
        }
        for (int i = start; i <=end; i++) {
            System.out.print(i+" ");
        }
        System.out.println();
        System.out.println(index);
    }
}
